package com.crm.system.service.impl;

import com.crm.dto.PartnerCount;
import com.crm.entity.Role;
import com.crm.system.mapper.SysRoleMapper;
import com.crm.system.service.SysRoleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysRoleServiceImpl implements SysRoleService {
    @Autowired
    private SysRoleMapper mapper;

    @Override
    public PageInfo<Role> list(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        return new PageInfo<>(mapper.list());
    }

    @Override
    public int Insert(Role role) {
        return mapper.Insert(role);
    }

    @Override
    public int Delete(String RoleId) {
        return mapper.Delete(RoleId);
    }

    @Override
    public List<Role> list() {
        return mapper.list();
    }

    @Override
    public String depId(String userId) {
        return mapper.depId(userId);
    }

    @Override
    public PageInfo<PartnerCount> partnerCount(String depId, String beginTime, String endTime, int pageIndex, int pageSize) {
       PageHelper.startPage(pageIndex,pageSize);
       List<PartnerCount> list=mapper.partnerCount(depId, beginTime, endTime);
        return new PageInfo<>(list);
    }


}
